/*----------------------------------------------------------------------------
 * osObjects.h: CMSIS-RTOS global object definitions for an application
 *----------------------------------------------------------------------------
 *
 * This header file defines global RTOS objects used throughout a project
 *
 * #define osObjectsPublic indicates that objects are defined; without that
 * definition the objects are defined as external symbols.
 *
 *--------------------------------------------------------------------------*/


#ifndef __os_obj__
#define __os_obj__


#ifdef __os_obj_creat__
#define OBJ_EXT  
#else
#define OBJ_EXT extern 
#endif

#include "cmsis_rt.h" 

#define ms_ticks(x)        (x*RT_TICK_PER_SECOND/1000)



int thread_init (void);
int os_obj_init (void);
    
typedef struct
{
    // global 'thread' functions ---------------------------------------------------    
    struct rt_thread  tid_sys_task;                                  // thread id
    uint32_t stk_sys_task[1024];
    
    struct rt_thread  tid_UsbTask;                                  // thread id
    uint32_t stk_usb_task[1024];
    
    rt_thread_t  tid_mbTask;                                   // thread id
    
    // global 'semaphores' ----------------------------------------------------------
    rt_mutex_t mid_eep;
    rt_mutex_t mid_q25;  
    rt_mutex_t mid_printf;
    
    // enent -------------------------------------------------------
    rt_event_t eid_mb;
    
    // global 'message queues' -------------------------------------------------------
    
    
    // global 'mail queues' ----------------------------------------------------------
    
} os_obj_type;

OBJ_EXT os_obj_type   os_obj;           


#endif  // __os_obj__
